#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstring>
using namespace std;

class student{
public:
    char id[100];
    char name[100];
    char sex[5];
    int age;
    bool operator < (const student &S) const {
        return strcmp(id, S.id) < 0;
    }
}buf_data[1000];

int main(int argc, char const *argv[]){
    int n;
    while(scanf("%d", &n) != EOF){
        for (int i = 0; i < n; i++){
            scanf("%s%s%s%d", buf_data[i].id, buf_data[i].name, buf_data[i].sex, &buf_data[i].age);
        }
        sort(buf_data, buf_data+n);
        int times;
        scanf("%d", &times);
        for (int i = 0; i < times; i++){
            int result = -1;
            char search_id[100];
            scanf("%s", search_id);
            int max = n - 1, min = 0;
            while(max >= min){
                int mid = (max + min) / 2;
                int tmp = strcmp(buf_data[mid].id, search_id);
                if (tmp == 0){
                    result = mid;
                    break;
                }else if (tmp > 0)
                    max = mid - 1;
                else
                    min = mid + 1;
            }
            if (result == -1)
                printf("No Answer!\n");
            else
                printf("%s %s %s %d\n", buf_data[result].id, buf_data[result].name, buf_data[result].sex, buf_data[result].age);
        }

    }
    return 0;
}
